// 自定义路由配置
// 页面内使用 definePageMeta({layout: 'main'}) 会失效
import type { RouteRecordRaw } from 'vue-router';
import Layout from '@/components/Layout/index.vue';
export const routes: RouteRecordRaw[] = [
    {
        path: '/redirect',
        meta: { hidden: true },
        component: Layout,
        children: [
            {
                path: '/redirect/:path(.*)',
                component: () => import('@/pages/redirect/index.vue'),
            },
        ],
    },
    {
        path: '/login',
        component: () => import('@/pages/login/index.vue'),
        name: '登录',
        meta: { title: 'login', hidden: true, layout: 'custom' },
    },
    {
        path: '/',
        component: () => import('@/pages/index.vue'),
        name: '首页',
        meta: { title: 'home', affix: true, icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求请求请求请求请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求请求请求请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },

    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/request',
        name: '请求',
        component: () => import('@/pages/request/index.vue'),
        meta: { title: 'request', icon: 'homepage' },
    },
    {
        path: '/utils',
        redirect: '/utils/table',
        name: '工具',
        meta: { title: 'utils', icon: 'homepage' },
        component: Layout,
        children: [
            {
                path: 'table',
                name: '表格',
                component: () => import('~/pages/utils/table/index.vue'),
                meta: { title: 'table' },
            },
        ],
    },
    {
        path: '/chart',
        name: '图表',
        meta: { title: 'chart', icon: 'homepage' },
        redirect: '/chart/lineChart',
        component: Layout,
        children: [
            {
                path: 'lineChart',
                name: '线性图',
                component: () => import('@/pages/chart/lineChart/index.vue'),
                meta: { title: 'lineChart', icon: 'homepage' },
                children: [
                    {
                        path: 'lineChart',
                        name: '线性图',
                        component: () => import('@/pages/chart/lineChart/index.vue'),
                        meta: { title: 'lineChart', icon: 'homepage', keepAlive: true },
                    },
                ],
            },
        ],
    },
];

export default {
    routes: (_routes: any) => {
        return routes;
    },
    // 路由滚动行为
    scrollBehavior: () => ({ left: 0, top: 0 }),
};
